package com.dzsw.stream8;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author sunz
 * @version 1.0
 * @CreateTime 2021-04-21-14:36
 */
public class ArraysStreamMain {

    public static void main(String[] args) {
        Integer[] ints = new Integer[]{1, 3, 5, 7, 9};
        List<Integer> list = Arrays.stream(ints).filter(x -> x % 2 != 0).collect(Collectors.toList());
        list.forEach(i -> System.out.printf("value is %s.\n", i));
        list.forEach(i -> {
            if (i == 5) {
                String s = String.format("go to %s", i);
                System.out.println("I find the number. is 5.");
            }
        });
    }
}
